<?php
/**
 * Model class for users table
 * @author Antonello D'Ippolito (http://www.antonellodippolito.com)
 */
class Users extends Zend_Db_Table_Abstract {
    protected $_name = 'ad_users';
    protected $_primary = 'id';
    
    /**
     * Check if login data is correct
     * @param string $username
     * @param string $password
     * @return bool True if correct 
     */
    public function checkLogin($username, $password) {
        $query = "SELECT * FROM ad_users WHERE username LIKE '".addslashes($username)."'";
        $res = $GLOBALS["db"]->fetchRow($query);
        if(md5($password)==$res->password) return true;
        else return false;
    }
}

?>
